import java.util.ArrayList;
import java.util.List;

/**
 * Team Lead Standup Meeting handles the initial meeting that needs 
 * to happen with all the team leads in the morning.
 * 
 * After the meeting is done it schedules the team meetings with 
 * each Team Lead.
 *
 */
public class TeamLeadStandup extends Meeting
{
	public TeamLeadStandup(Time eventTime, List<Employee> members,
		TimeDuration lengthOfMeeting, String name)
	{
		super(eventTime, members, lengthOfMeeting, name);
	}

	@Override
	protected void onEmployeeFinishedMeeting(Employee employee)
	{
		//If the employee executing this is a team lead, schedule the team meetings
		if (employee instanceof TeamLead)
		{
			//Get the team lead
			TeamLead lead = (TeamLead) employee;
			//Get it's schedule reference
			Schedule schedule = lead.getSchedule();
			//Grab the list of employees that need to be at this meeting
			List<Employee> employeesForMeeting = new ArrayList<Employee>(
				lead.getTeamIncludingSelf());
			employeesForMeeting.add(schedule.getConferenceRoom());
			
			//Schedule the Team Meetings after this meeting is done, for 15 minutes.
			Meeting meeting = new Meeting(new Time(schedule.getCurrentTime()),
				employeesForMeeting, new TimeDuration(0, 15), "Team "
					+ lead.getTeamNumber() + " Standup Meeting");
			//Send the event off
			schedule.scheduleEvent(meeting);
		}
	}
}
